package com.ruoyi.personnel.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.personnel.domain.Rotation;
import com.ruoyi.personnel.mapper.RotationMapper;
import com.ruoyi.personnel.service.IRotationService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 护士轮转记录Service业务层处理
 *
 * @author ruoyi
 * @date 2021-02-26
 */
@Service
public class RotationServiceImpl extends ServiceImpl<RotationMapper, Rotation> implements IRotationService {

    @Override
    public List<Rotation> queryList(Rotation rotation) {
        LambdaQueryWrapper<Rotation> lqw = Wrappers.lambdaQuery();
        if (StringUtils.isNotBlank(rotation.getName())){
            lqw.like(Rotation::getName ,rotation.getName());
        }
        if (StringUtils.isNotBlank(rotation.getJobNumber())){
            lqw.eq(Rotation::getJobNumber ,rotation.getJobNumber());
        }
        if (StringUtils.isNotBlank(rotation.getPersonnelId())){
            lqw.eq(Rotation::getPersonnelId ,rotation.getPersonnelId());
        }
        if (StringUtils.isNotBlank(rotation.getRotationOffice())){
            lqw.eq(Rotation::getRotationOffice ,rotation.getRotationOffice());
        }
        if (rotation.getRotationOfficeId() != null){
            lqw.eq(Rotation::getRotationOfficeId ,rotation.getRotationOfficeId());
        }
        if (StringUtils.isNotBlank(rotation.getEnterDate())){
            lqw.eq(Rotation::getEnterDate ,rotation.getEnterDate());
        }
        if (StringUtils.isNotBlank(rotation.getLeaveDate())){
            lqw.eq(Rotation::getLeaveDate ,rotation.getLeaveDate());
        }
        if (StringUtils.isNotBlank(rotation.getAbilityEvaluation())){
            lqw.eq(Rotation::getAbilityEvaluation ,rotation.getAbilityEvaluation());
        }
        if (StringUtils.isNotBlank(rotation.getTheoreticalResult())){
            lqw.eq(Rotation::getTheoreticalResult ,rotation.getTheoreticalResult());
        }
        if (StringUtils.isNotBlank(rotation.getOperationResult())){
            lqw.eq(Rotation::getOperationResult ,rotation.getOperationResult());
        }
        if (StringUtils.isNotBlank(rotation.getOverallEvaluation())){
            lqw.eq(Rotation::getOverallEvaluation ,rotation.getOverallEvaluation());
        }
        if (StringUtils.isNotBlank(rotation.getReviewer())){
            lqw.eq(Rotation::getReviewer ,rotation.getReviewer());
        }
        if (StringUtils.isNotBlank(rotation.getEvaluate())){
            lqw.eq(Rotation::getEvaluate ,rotation.getEvaluate());
        }
        if (StringUtils.isNotBlank(rotation.getStatus())){
            lqw.eq(Rotation::getStatus ,rotation.getStatus());
        }
        return this.list(lqw);
    }
}
